<script setup>
 let msg ="hello vue3"
  let getMsg= ()=>{
    return 'hello vue3 message'
  }
  let age = 19
  let bee = '蜜 蜂'
  // 购物车
  const carts = [{name:'可乐',price:3,number:10},{name:'薯片',price:6,number:8}];

  let totalPrice=0;
  let getTotalPrice=()=>{
    for(let index in carts){
        totalPrice+=carts[index].number*carts[index].price
    }
    return totalPrice;
  }
</script>

<template>
    <div>
  <span>{{ msg }}</span>
  <p>{{ getMsg() }}</p>
  <h1>{{ age>18?"成年":"未成年" }}</h1>
  <p>{{ bee.split(" ").reverse().join("-") }}</p>
  <h2>{{ carts[0].price }}</h2>
  <h3>{{ getTotalPrice() }}</h3>
</div>
</template>

<style scoped>

</style>
